package com.sxpi.chapter.chapter02.card;

import lombok.extern.slf4j.Slf4j;

import java.math.BigDecimal;
import java.util.List;

/**
 * @Author: 董伟豪
 * @Date: 2022/12/31 16:59
 */
@Slf4j
public abstract class BankCard {

    // 公共属性
    private String cardNo;
    private String cardDate;

    public BankCard(String cardNo, String cardDate) {
        this.cardNo = cardNo;
        this.cardDate = cardDate;
    }

    /**
     * 入款
     * @param orderId
     * @param amount
     * @return
     */
    public String putMoney(String orderId, BigDecimal amount) {
        log.info("卡号:{},入款成功，单号:{},金额：{}", cardNo, orderId, amount);
        return "0000";
    }

    /**
     * 取款
     * @param orderId
     * @param amount
     * @return
     */
    public String getMoney(String orderId, BigDecimal amount) {
        log.info("卡号:{},取款成功，单号:{},金额：{}", cardNo, orderId, amount);
        return "0000";
    }

    abstract boolean rule(BigDecimal amount);

    /**
     * 体现
     *
     * @param orderId
     * @param amount
     * @return
     */
    abstract String handleGet(String orderId, BigDecimal amount);

    /**
     * 储蓄
     *
     * @param orderId
     * @param amount
     * @return
     */
    abstract String handlePut(String orderId, BigDecimal amount);

    /**
     * 信用卡
     *
     * @return
     */
    public List<String> printlnFlow() {
        List<String> lists = List.of("120000", "1120000", "220000", "320000");
        return lists;
    }


    public String getCardNo() {
        return cardNo;
    }

    public String getCardDate() {
        return cardDate;
    }

}
